# 创建一个User类实体，包括用户的id，用户名，密码，邮箱，手机号，注册时间,toString()方法
class User:
    def __init__(self, id, username, password, email, phone, register_time):  # 初始化方法
        # 将传入的id参数赋值给实例变量self.id
        self.id = id
        # 将传入的username参数赋值给实例变量self.username
        self.username = username
        # 将传入的password参数赋值给实例变量self.password
        self.password = password
        # 将传入的email参数赋值给实例变量self.email
        self.email = email
        # 将传入的phone参数赋值给实例变量self.phone
        self.phone = phone
        # 将传入的register_time参数赋值给实例变量self.register_time
        self.register_time = register_time

    def toString(self):  # toString()方法
        # 返回一个格式化的字符串，包含用户的id、用户名、密码、邮箱、电话和注册时间
        return "User[id=%s, username=%s, password=%s, email=%s, phone=%s, register_time=%s]" % (
        self.id, self.username, self.password, self.email, self.phone, self.register_time)


# 测试User类实体
if __name__ == '__main__':
    user = User(1, 'admin', 'admin', 'admin@example.com', '12345678901', '2022-01-01 00:00:00')
print(user.toString())
# 输出：User[id=1, username=admin, password=admin, email=admin@example.com, phone=12345678901, register_time=2022-01-01 00:00:00]
